package cn.tedu.egmvcboot.common.result;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class JsonResult {
    @ApiModelProperty(value = "状态码", required = true,example = "10100")
    private Integer statusCode;
    @ApiModelProperty(value = "描述信息",required = true,example = "操作成功")
    private String message;
    @ApiModelProperty(value = "响应数据")
    private Object data;

    public JsonResult(Status status) {
        this.statusCode = status.getStatusCode();
        this.message = status.getMessage();
    }
    public JsonResult(Status status,Object data) {
        this(status);
        this.data = data;
    }
    public static JsonResult success() {
//        return new JsonResult(Status.OPERATION_SUCCESS);
        return success(null);
    }
    public static JsonResult success(Object data) {
        return new JsonResult(Status.OPERATION_SUCCESS,data);
    }
}
